﻿var b = true;
var ArticlePublishId = "";

function getNodeValue(o) {
    try {
        return o.item(0).firstChild.nodeValue;
    }
    catch (err) {
        return '';
    }
}

function textCounter(field, cntfield, maxlimit) {
    var CharLeft;
    if (field.value.length > maxlimit) {
        field.value = field.value.substring(0, maxlimit);
    }
    else {
        CharLeft = maxlimit - field.value.length;
        cntfield.innerHTML = CharLeft + " character left";
        if (CharLeft == 0) {
            cntfield.style.color = "#FF0000";
        } else {
            cntfield.style.color = "#000";
        }
    }
}


var RSS = {
    init: function(vUrl, vItem, vDivId) {
        AjaxRequest.get(
    	{
    	    "url": vUrl
    	    , 'onLoading': function() { gmobj(vDivId).innerHTML = "<div class=\"loadingDiv\">Loading ...</div>"; }
    		, 'onSuccess': function(req) {
    		    var title = "";
    		    var link = "";
    		    var postdate = "";
    		    var strOut = "";

    		    strOut = "<table cellpadding=\"4\" cellspacing=\"6\" border=\"0\" width=\"100%\" class=\"tblDashboard\">";
    		    for (i = 0; i <= vItem; i++) {
    		        title = getNodeValue(req.responseXML.getElementsByTagName('item').item(i).getElementsByTagName('title'));
    		        link = getNodeValue(req.responseXML.getElementsByTagName('item').item(i).getElementsByTagName('link'));
    		        postdate = getNodeValue(req.responseXML.getElementsByTagName('item').item(i).getElementsByTagName('pubDate'));

    		        strOut += "  <tr>";
    		        strOut += "      <td><a href=\"".concat(link).concat("\" title=\"").concat(title).concat("\">").concat(title).concat("</a><span class=\"lblPostDate\"> - ").concat(dateFormat(postdate, "fullDate")).concat("</span></td>");
    		        strOut += "  </tr>";
    		    }
    		    strOut += "</table>";
    		    gmobj(vDivId).innerHTML = strOut;
    		}
    		, 'onError': function(req) {
    		    gmobj(vDivId).innerHTML = req.statusText;
    		}
    	});
    }
}

var Dashboard = {
    getTop5Comment: function(vId) {
        try {
            AjaxRequest.get(
	            {
	                "url": "/Services/Dashboard.ashx?action=Top5Comments"
	                , 'onLoading': function() { gmobj(vId).innerHTML = "<div class=\"loadingDiv\">Loading ...</div>"; }
		            , 'onSuccess': function(req) { gmobj(vId).innerHTML = req.responseText; }
		            , 'onError': function(req) { gmobj(vId).innerHTML = req.statusText; }
	            });
        } catch (err) {
            return "";
        }
    },
    getStatics: function(vId) {
        try {
            AjaxRequest.get(
                {
                    "url": "/Services/Dashboard.ashx?action=Activity"
                    , 'onLoading': function() { gmobj(vId).innerHTML = "<div class=\"loadingDiv\">Loading ...</div>"; }
                    , 'onSuccess': function(req) { gmobj(vId).innerHTML = req.responseText; }
                    , 'onError': function(req) { gmobj(vId).innerHTML = req.statusText; }
                });
        } catch (err) {
            return "";
        } 
    }
}

var Util = {
    CheckAll: function(chk) {
        if (b) {
            for (i = 0; i < chk.length; i++) {
                chk[i].checked = true;
            }
            b = false;
        } else {
            for (i = 0; i < chk.length; i++) {
                chk[i].checked = false;
            }
            b = true;
        }
    },
    ConfirmDeleteArticle: function(vMsg) {
        if (confirm("You are about to delete this post '" + vMsg + "'\nCancel to stop, OK to delete.")) {
            return true;
        } else {
            return false;
        }
        return false;
    },
    ConfirmDeleteTag: function(vMsg) {
        if (confirm("You are about to delete this tag '" + vMsg + "'\nCancel to stop, OK to delete.")) {
            return true;
        } else {
            return false;
        }
        return false;
    },
    DisplayPostAction: function(vId) {
        gmobj(vId).style.display = "";
    },
    HidePostAction: function(vId) {
        gmobj(vId).style.display = "none";
    },
    PublishConfirmAction: function() {
        var month = parseInt(gmobj("mmmm").value);
        var day = parseInt(gmobj("dd").value);
        var year = parseInt(gmobj("yy").value);
        var hh = parseInt(gmobj("hh").value);
        var mn = parseInt(gmobj("mn").value);
        var ss = parseInt(gmobj("ss").value);
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        var sOut = "";
        var ampm = "";

        if (hh > 23) { hh = 0; }
        if (mn > 59) { mn = 0; }
        if (month < 1 || month > 12) { month = 12; }
        if (day < 1 || day > 31) { day = 31; }
        if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) { month--; }
        if (ss > 59) { ss = 59; }
        if (hh > 12) { hh = hh - 12; ampm = "PM"; } else if (hh == 12) { ampm = "PM"; } else { ampm = "AM"; }
        if (month == 2) {
            if (day > 29 || (day == 29 && !isleap)) { day = 28; }
        }
        sOut = month.toString() + "/" + day.toString() + "/" + year.toString() + " " + hh.toString() + ":" + mn.toString() + ":" + ss.toString() + " " + ampm;
        gmobj("txtReleaseDate").value = sOut;
        gmobj(ArticlePublishId).style.display = "none";
        gmobj("PublishInfo").innerHTML = "Schedule for: <b>" + dateFormat(sOut, "mmm d, yyyy") + " @ " + dateFormat(sOut, "HH:MM") + "</b>";
        gmobj("lnkEditDatePublish").style.display = "";
        gmobj("mmmm").value = month.toString();
        gmobj("dd").value = day.toString();
        gmobj("yy").value = year.toString();
        gmobj("hh").value = hh.toString();
        gmobj("mn").value = mn.toString();
        gmobj("ss").value = ss.toString();
    },
    CancelArticlePublish: function() {
        gmobj(ArticlePublishId).style.display = "none";
        gmobj("lnkEditDatePublish").style.display = "";
    },
    EditArticlePublish: function(vId) {
        gmobj(vId).style.display = "";
        gmobj("lnkEditDatePublish").style.display = "none";
        ArticlePublishId = vId;
    },
    ConfirmAction: function(vId) {
        if (gmobj("txtArticlePublic").checked) {
            gmobj("lnkEdit").style.display = "";
            gmobj("ArticleVisibility").innerHTML = "Public";
            gmobj(vId).style.display = "none";
            gmobj("txtArticlePwd").value = "";
            gmobj("txtPostVisible").value = "0";
        } else if (gmobj("txtArticlePassword").checked) {
            gmobj("lnkEdit").style.display = "";
            gmobj("ArticleVisibility").innerHTML = "Password Protected";
            gmobj(vId).style.display = "none";
            gmobj("txtPostVisible").value = "1";
        } else if (gmobj("txtArticlePrivate").checked) {
            gmobj("lnkEdit").style.display = "";
            gmobj("ArticleVisibility").innerHTML = "Private";
            gmobj(vId).style.display = "none";
            gmobj("txtArticlePwd").value = "";
            gmobj("txtPostVisible").value = "2";
        }
    },
    CancelArticleVisible: function(vId) {
        gmobj(vId).style.display = "none";
        gmobj("lnkEdit").style.display = "";
        switch (gmobj("txtPostVisible").value) {
            case "0":
                gmobj("txtArticlePublic").checked = true;
                break;
            case "1":
                gmobj("txtArticlePassword").checked = true;
                break;
            case "2":
                gmobj("txtArticlePrivate").checked = true;
                break;
        }
    },
    ArticlePublic: function() {
        gmobj("frmArticlePwd").style.display = "none";
        gmobj("txtArticlePwd").value = "";
    },
    ArticlePrivate: function() {
        gmobj("frmArticlePwd").style.display = "none";
        gmobj("txtArticlePwd").value = "";
    },
    ArticlePassword: function() {
        gmobj("frmArticlePwd").style.display = "";
    },
    EditArticleVisible: function(vId) {
        gmobj(vId).style.display = "";
        gmobj("lnkEdit").style.display = "none";
        if (gmobj("txtPostVisible").value == "1") {
            gmobj("frmArticlePwd").style.display = "";
        }
    },
    DisplayAction: function(vId) {
        gmobj("row-actions-" + vId).style.display = "";
    },
    HideAction: function(vId) {
        gmobj("row-actions-" + vId).style.display = "none";
    },
    doCol: function() {
        if (b) {
            gmobj("commentct").style.display = "none";
            b = false;
        }
        else {
            gmobj("commentct").style.display = "";
            b = true;
        }
    },
    ContactUs: function(strLink) {
        window.open(strLink, 'Toasoan', 'height=740px,width=780px,status=no,toolba=no,location=no');
    },
    GoTo: function(strLink) {
        location.href = strLink;
    },
    writeDate: function() {
        var d = new Date();
        var today = d.getDate();
        var thisyear = d.getFullYear();
        var thismonth = d.getMonth() + 1;
        //alert(d.)
        var weekday = new Array("Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy")
        document.write(weekday[d.getDay()] + ", Ngày " + today + " tháng " + thismonth + " năm " + thisyear);
    },
    VnMode: function(id) {
        if (b) {
            document.images[id].src = "/justin/images/vnfont.gif";
            document.images[id].alt = "Tiếng Việt";
            setTypingMode(1);
            b = false;
        } else {
            document.images[id].src = "/justin/images/enfont.gif";
            document.images[id].alt = "Tiếng Anh";
            setTypingMode(0);
            b = true;
        }
    },
    GetTestUrlTO: function(strUrl, vId) {
        AjaxRequest.get(
        {
            "url": "/Services/CustomUrl.ashx?action=GetUrl&Title=" + Url.encode(strUrl)
            , 'onSuccess': function(req) { gmobj(vId).innerHTML = req.responseText; Util.ReturnUrl(); }
            , 'onError': function(req) { gmobj(vId).innerHTML = req.statusText; }
        });
    },
    GetTestUrl: function(strUrl, vId) {
        var t = setTimeout("Util.GetTestUrlTO('" + strUrl + "','" + vId + "');", 2000);    
    },
    ShowFormEditUrl: function(vId) {
        var vOldTitle = gmobj(vId).innerHTML;
        gmobj(vId).removeAttribute("onclick", "");
        gmobj(vId).style.backgroundColor = "transparent";
        gmobj(vId).innerHTML = "<input style=\"width:250px;\" value=\"" + vOldTitle + "\" type=\"text\" name=\"txtTestTitle\" id=\"txtTestTitle\" /><input type=\"button\" name=\"btnGetTitle\" id=\"btnGetTitle\" onclick=\"javascript:Util.GetTitle('" + vId + "');\" value=\"OK\" /><input type=\"button\" name=\"btnCancelSetTitle\" id=\"btnCancelSetTitle\" onclick=\"javascript:Util.CancelSetTitle('" + vId + "','" + vOldTitle + "');\" value=\"Cancel\" />"
    },
    GetTitle: function(vId) {
        AjaxRequest.get(
        {
            "url": "/Services/CustomUrl.ashx?action=SetTitle&Title=" + Url.encode(gmobj("txtTestTitle").value)
            , 'onSuccess': function(req) {
                gmobj(vId).style.backgroundColor = "#FCE04E";
                gmobj(vId).setAttribute("onclick", "javascript:Util.ShowFormEditUrl('spnTitle');");
                gmobj(vId).innerHTML = req.responseText;
                gmobj("ctl00_ctph_txtTitle").removeAttribute("onfocus", "");
                gmobj("ctl00_ctph_txtTitle").removeAttribute("onblur", "");
                Util.ReturnUrl();
            }
            , 'onError': function(req) { }
        });
    },
    CancelSetTitle: function(vId, vOldTitle) {
        gmobj(vId).innerHTML = vOldTitle;
        gmobj(vId).style.backgroundColor = "#FCE04E";
        var t = setTimeout("Util.ReturnSetShowForm('" + vId + "');", 1000);
    },
    ReturnSetShowForm: function(vId) {
        gmobj(vId).setAttribute("onclick", "javascript:Util.ShowFormEditUrl('spnTitle');");
    },
    ReturnUrl: function() {
        AjaxRequest.get(
        {
            "url": "/Services/CustomUrl.ashx?action=ReturnUrl&Title=" + Url.encode(gmobj("divTestUrl").innerHTML)
            , 'onSuccess': function(req) { gmobj("txtTestUrl").value = req.responseText; }
            , 'onError': function(req) { }
        });
    }
}
var Menus = {
    DisplaySubMenu: function(id) {
        gmobj(id).style.display = '';
        gmobj("tg" + id.toString().replace("menu-", "").replace("-2", "")).className = "wp-menu-toggle-selected";
        gmobj("tg" + id.toString().replace("menu-", "").replace("-2", "")).removeAttribute("onclick", "");
        gmobj("tg" + id.toString().replace("menu-", "").replace("-2", "")).setAttribute("onclick", "javascript:Menus.HideSubMenu('" + id + "');");
    },
    HideSubMenu: function(id) {
        gmobj(id).style.display = 'none';
        gmobj("tg" + id.toString().replace("menu-", "").replace("-2", "")).className = "wp-menu-toggle";
        gmobj("tg" + id.toString().replace("menu-", "").replace("-2", "")).removeAttribute("onclick", "");
        gmobj("tg" + id.toString().replace("menu-", "").replace("-2", "")).setAttribute("onclick", "javascript:Menus.DisplaySubMenu('" + id + "');");
    },
    ChangeSelectedMenu: function(id) {
        var vStyle = "";
        var Temp = "";
        var Temp2 = "";
        switch (id.toString().replace("menu-", "").replace("-2", "")) {
            case "0":
                vStyle = "dashboard"
                break;
            case "1":
                vStyle = "posts";
                break;
            case "2":
                vStyle = "media";
                break;
            case "3":
                vStyle = "link";
                break;
            case "4":
                vStyle = "page";
                break;
            case "5":
                vStyle = "cm";
                break;
        }

        for (var i = 0; i < 6; i++) {
            if (i == id.toString().replace("menu-", "").replace("-2", "")) {
                Temp2 = gmobj("menu-" + i + "-1").classNatoString().replace("-normal", "");
                gmobj("menu-" + i + "-0").className = vStyle + "Selected";
                gmobj("menu-" + i + "-1").className = Temp2;
            } else {
                Temp = gmobj("menu-" + i + "-0").classNatoString().replace("Selected", "Normal");
                Temp2 = gmobj("menu-" + i + "-1").classNatoString().toString().replace("-normal", "") + "-normal";                
                gmobj("menu-" + i + "-0").className = Temp;
                gmobj("menu-" + i + "-1").className = Temp2;
            }
        }
    }
}

var Tags = {
    ShowTag: function(id) {
        if (b) {
            gmobj(id).style.display = '';
            b = false;
        } else {
            gmobj(id).style.display = 'none';
            b = true;
        }
    },
    AddThisTag: function(TagName,TargetID) {
        var tagvalue = gmobj(TargetID).value;
        if (tagvalue.length < 1) {
            tagvalue = TagName;
        } else {
            tagvalue += "," + TagName;
        }
        gmobj(TargetID).value = tagvalue;
        gmobj(TargetID).focus();
    }
}

function gmobj(mtxt) { if (document.getElementById) { m = document.getElementById(mtxt) } else if (document.all) { m = document.all[mtxt] } else if (document.layers) { m = document[mtxt] } return m; }

function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }
	return true					
}

function vote_poll(the_form){
			width		= 550;
			height		= 250;
			top_val		= (screen.height - height)/2 - 30;
			if (top_val < 0){ top_val	= 0; }
			left_val	= (screen.width - width)/2;
		
			window.open('', the_form.name, "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+ width +",height="+ height +", top="+ top_val +",left="+ left_val);
			the_form.submit();
}

function openImage(vLink, vHeight, vWidth)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	if (sLink == '')
	{
		return false;
	}

	winDef = 'status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no,fullscreen=yes,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	newwin = open('', '_blank', winDef);
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" border=0></a>');
	newwin.document.writeln('</body>');

	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
function openWin(linkID,w,h){
			width		= w;
			height		= h;
			top_val		= (screen.height - height)/2 - 30;
			if (top_val < 0){ top_val	= 0; }
			left_val	= (screen.width - width)/2;
			
			//linkID+="?id="+id;
			window.open(linkID,null, "toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=0,width="+ width +",height="+ height +", top="+ top_val +",left="+ left_val);
			//the_form.submit();
}	

/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/

var Url = {

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

var dateFormat = function() {
    var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
		timezoneClip = /[^-+\dA-Z]/g,
		pad = function(val, len) {
		    val = String(val);
		    len = len || 2;
		    while (val.length < len) val = "0" + val;
		    return val;
		};

    // Regexes and supporting functions are cached through closure
    return function(date, mask, utc) {
        var dF = dateFormat;

        // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
        if (arguments.length == 1 && (typeof date == "string" || date instanceof String) && !/\d/.test(date)) {
            mask = date;
            date = undefined;
        }

        // Passing date through Date applies Date.parse, if necessary
        date = date ? new Date(date) : new Date();
        if (isNaN(date)) throw new SyntaxError("invalid date");

        mask = String(dF.masks[mask] || mask || dF.masks["default"]);

        // Allow setting the utc argument via the mask
        if (mask.slice(0, 4) == "UTC:") {
            mask = mask.slice(4);
            utc = true;
        }

        var _ = utc ? "getUTC" : "get",
			d = date[_ + "Date"](),
			D = date[_ + "Day"](),
			m = date[_ + "Month"](),
			y = date[_ + "FullYear"](),
			H = date[_ + "Hours"](),
			M = date[_ + "Minutes"](),
			s = date[_ + "Seconds"](),
			L = date[_ + "Milliseconds"](),
			o = utc ? 0 : date.getTimezoneOffset(),
			flags = {
			    d: d,
			    dd: pad(d),
			    ddd: dF.i18n.dayNames[D],
			    dddd: dF.i18n.dayNames[D + 7],
			    m: m + 1,
			    mm: pad(m + 1),
			    mmm: dF.i18n.monthNames[m],
			    mmmm: dF.i18n.monthNames[m + 12],
			    yy: String(y).slice(2),
			    yyyy: y,
			    h: H % 12 || 12,
			    hh: pad(H % 12 || 12),
			    H: H,
			    HH: pad(H),
			    M: M,
			    MM: pad(M),
			    s: s,
			    ss: pad(s),
			    l: pad(L, 3),
			    L: pad(L > 99 ? Math.round(L / 10) : L),
			    t: H < 12 ? "a" : "p",
			    tt: H < 12 ? "am" : "pm",
			    T: H < 12 ? "A" : "P",
			    TT: H < 12 ? "AM" : "PM",
			    Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
			    o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
			    S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
			};

        return mask.replace(token, function($0) {
            return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
        });
    };
} ();

// Some common format strings
dateFormat.masks = {
    "default": "ddd mmm dd yyyy HH:MM:ss",
    shortDate: "m/d/yy",
    mediumDate: "mmm d, yyyy",
    longDate: "mmmm d, yyyy",
    fullDate: "dddd, mmmm d, yyyy",
    shortTime: "h:MM TT",
    mediumTime: "h:MM:ss TT",
    longTime: "h:MM:ss TT Z",
    isoDate: "yyyy-mm-dd",
    isoTime: "HH:MM:ss",
    isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
    isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
dateFormat.i18n = {
    dayNames: [
		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
	],
    monthNames: [
		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	]
};

// For convenience...
Date.prototype.format = function(mask, utc) {
    return dateFormat(this, mask, utc);
};
